package net.zjitc.link;

public class SingleLinkDemo {
    public static void main(String[] args) {
        int size = 0;
        //01 02
        Node<Student> first =  new Node<Student>(new Student("01","a"));
        Node<Student> last = first;
        size++;

        last.next = new Node<>(new Student("02","b"));
        last = last.next;
        size++;


        last.next=  new Node<>(new Student("03","c"));
        last = last.next;
        size++;


        //5个节点
        last.next=  new Node<>(new Student("04","c"));
        last = last.next;
        size++;


        last.next=  new Node<>(new Student("05","c"));
        last = last.next;
        size++;


        Node<Student> before = null;
        Node<Student> p = first;
        Node<Student> after = null;

        while (p!= null){
            after = p.next;
            p.next = before;
            before = p;
            p = after;
        }

        last = first;
        first = before;

    }
}
